Skip to content

fix: normalize locked orchestrator health response bodies - #695

Merged
seonghobae merged 2 commits into
mainfrom
fix/orchestrator-health-locked-reader-20260913
Sep 12, 2026
Merged

fix: normalize locked orchestrator health response bodies#695
seonghobae merged 2 commits into
mainfrom
fix/orchestrator-health-locked-reader-20260913

Conversation

@seonghobae

@seonghobae seonghobae commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Problem

The contextual-orchestrator /healthz verifier already bounds streamed response bytes and makes cancellation best-effort, but it still called response.body.getReader() without normalizing synchronous reader-acquisition failure. A legitimately locked/non-stream-readable ReadableStream could therefore surface implementation-specific stream errors instead of one stable Noema transport diagnostic.

This is a Noema-owned health-response consumption/error-admission repair only. It does not move contextual-orchestrator service/provider/model routing, credentials, outbound authority, quarantine/security authority, release/deployment authority, or foreign domain truth into Noema.

Test-first RED

Test-only exact head: b66ee03c5a0ce57c7e346162353e4e7b852de0a0.

The hostile regression holds a real Response.body reader before verifyOrchestratorHealthz() attempts acquisition and requires the stable diagnostic:

contextual-orchestrator health response body is not stream-readable

A direct runtime reproduction against the protected implementation produced the underlying failure (TypeError: Invalid state: ReadableStream is locked), proving the current acquisition path leaked stream implementation detail. Hosted Actions for the test-only head entered the repository runner queue and had not been assigned when the minimal source repair was committed; the test-only commit remains immutable evidence.

Minimal repair

Current exact head: c9d526093e543167645383e937096fd089b337f8.

Only health-response reader acquisition is wrapped. Synchronous acquisition failure is normalized to the stable transport diagnostic. The existing 65,536-byte ceiling, optional caller-supplied deadline (no invented default timeout), fixed retained buffer, best-effort cancellation, fatal UTF-8, duplicate-key/JSON admission, orchestrator/free routing contract, and contextual-orchestrator ownership boundary are unchanged.

Verification

Final exact-head hosted CI/review/security/image gates are required before merge. No gate weakening, provider fallback, direct provider routing, self-approval, force-push, or destructive rebase is permitted.

Summary by CodeRabbit

  • 버그 수정
    • 오케스트레이터 상태 확인 중 응답 본문 스트림을 읽을 수 없는 경우, 원시 오류 대신 이해하기 쉬운 오류 메시지가 표시되도록 개선했습니다.
    • 응답 스트림이 이미 사용 중인 상황에서도 오류가 일관되게 처리됩니다.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 693ba052-542e-44aa-a586-f4f019e72049

📥 Commits

Reviewing files that changed from the base of the PR and between 69164f2 and c9d5260.

📒 Files selected for processing (2)
  • scripts/lib/orchestrator-gateway.mjs
  • test/orchestrator-gateway-stream-bound.test.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

verifyOrchestratorHealthz가 응답 본문 reader 획득 실패를 전용 오류로 변환합니다. 잠긴 응답 본문에서 이 동작을 검증하는 테스트를 추가합니다.

Changes

Health 응답 스트림 오류 처리

Layer / File(s) Summary
Reader 획득 오류 정규화 및 검증
scripts/lib/orchestrator-gateway.mjs, test/orchestrator-gateway-stream-bound.test.ts
getReader() 예외를 "contextual-orchestrator health response body is not stream-readable" 오류로 변환합니다. 잠긴 응답 본문에서 오류 메시지와 잠금 해제를 검증합니다.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to c9d52

The change is narrowly scoped and preserves existing fallback behavior; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 잠긴 orchestrator health response body의 오류 정규화라는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/orchestrator-health-locked-reader-20260913

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@seonghobae
seonghobae marked this pull request as ready for review September 12, 2026 23:03

@seonghobae seonghobae left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exact-head review on c9d526093e543167645383e937096fd089b337f8: the diff is limited to normalizing synchronous health-response reader acquisition failure plus its hostile locked-stream regression. Existing byte ceiling, timeout semantics, bounded retained buffer, cancellation liveness, UTF-8/duplicate-key JSON admission, and contextual-orchestrator ownership boundary remain unchanged. Application CI, reviewer-ci, required Security Scan, and patch-validator-image are all terminal SUCCESS; CodeRabbit reports no actionable finding; unresolved inline threads: 0. COMMENT only; this is not self-approval.

@seonghobae
seonghobae merged commit ece6ced into main Sep 12, 2026
18 checks passed
@seonghobae
seonghobae deleted the fix/orchestrator-health-locked-reader-20260913 branch September 12, 2026 23:07
seonghobae added a commit that referenced this pull request Sep 12, 2026
seonghobae added a commit that referenced this pull request Sep 12, 2026
seonghobae added a commit that referenced this pull request Sep 12, 2026
…alth-reader-authority-20260913

docs: converge protected #695 health reader authority
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant